A number of executable files have been written, debugged and used for a wide variety of purposes. For example, libraries of executable files have been created with the executable files within the library configured to perform different respective functions. As such, a computer program can call or otherwise access various files within the library in order to make use of the respective functions. These executable files have been written in a variety of languages including, for example, Fortran and C. Notwithstanding the wealth of executable files written in various legacy languages, such as Fortran and C, newer programming languages have been developed and are being widely adopted, including, for example, C++ and various scripting languages, such as Java, Python, Jython and Groovy. These newer programming languages offer numerous advantages with some being considered relatively easy to use by programmers and offering more freedom from complex development environments by avoiding the use of compilers, linkers or the like.
It is relatively common for computer programs written in a newer or different language to need to perform the same functions as those performed by existing executable files written in a legacy language. In order to provide those same functions, the existing executable files written in the legacy language may be rewritten in the new language. As will be apparent, this approach is relatively labor intensive and may require significant time and expense to recreate and validate the functions previously performed by the executable files written in the legacy language.
Alternatively, an interface can be written to permit a computer program written in a newer or different language to access and make use of the functions performed by executable files written in a legacy language. Among other things, the interface must identify the name of the legacy function to be accessed and define the parameters, if any, to be provided to the legacy function as well as the manner in which input and output parameters used by the legacy function are to be handled. In light of the relatively voluminous libraries of functions written in C and other legacy languages, it would be desirable for the interface to be generated in as automated of a fashion as possible. As such, interface generation applications, such as the Simplified Wrapper Interface Generator (SWIG), have been developed in order to assist developers in the generation of an interface between a target language, such as a scripting language, and legacy C functions. SWIG generates a wrapper function that converts each argument from the target language data type to the legacy language, confirms their validity, calls the legacy C function and then converts the returned parameters back into parameters recognized by the target language.
However, the code generated by an interface generation application such as by the SWIG including the wrapper functions can be somewhat difficult for developers to use. Thus, a number of developers still hand wrap each of the automatically generated wrapper functions to facilitate use of the wrapper functions in the scripting language. However, the hand wrapping of the automatically generated wrapper functions can result in a substantial amount of effort and time even though the interface itself is automatically generated.
In addition to SWIG, other interface generation applications have been developed in order to convert legacy C files to a specific target language. For example, the Boost interface generation application has been developed to support usage of legacy C files by Python programs and a JNI interface generation application has been developed to support the use of legacy C files by Java programs. As noted, however, each of these interface generation applications is specific to an individual target language, and, as such, a different interface must be generated in order to facilitate use of the same legacy C files by computer programs written in another language.
As such, it would be desirable to provide an improved interface generation application for permitting software programs written in one or more languages to utilize legacy files, such as the various functions of a legacy library. In this regard, it would be desirable to automatically generate such an interface in a manner that reduces the manual work that would be otherwise required in order to utilize the automatically generated interface. Additionally, it would be desirable to provide an automatically generated interface between legacy files and multiple target languages, such as various scripting languages, in order to increase the flexibility provided to the user with respect to the use of the legacy files.